SET VER=01.00.00
SET COMPILE=RELEASE
set ARCHIVEFOLDER=\\echidna\ifinity\Installs
ECHO OFF

if NOT x%1 == x""  set COMPILE=%1

REM delete the install directory for fresh files every time
del install /Q /F /S
md install
md install\resources
md install\resources\App_LocalResources

SET PROD=DotNetNuke.Modules.SocialDashboard
set PRODVER=%PROD%_%VER%
set SRC_ZIP=%PROD%_%VER%_Source.zip

ECHO ================== Start Copy %PROD% ====================================================
ECHO ON
copy %Prod%\bin\%COMPILE%\DotNetNuke.Modules.SocialDashboard*.dll Install\
if "%COMPILE%" == "DEBUG" copy %Prov%\bin\%COMPILE%\DotNetNuke.Modules.SocialDashboard*.pdb Install\
copy %Prod%\*.dnn Install\
copy %Prod%\Data\SqlDataProvider\*.SqlDataProvider Install\

copy %prod%\App_LocalResources\*.resx Install\Resources\App_LocalResources
copy %prod%\*.ascx Install\Resources

SET INSTALL_ZIP=%PROD%_%VER%_Install.zip
SET RESOURCES_ZIP=%PROD%_Resources.zip
SET DEBUG_INSTALL_ZIP=%PROD%_%VER%_Debug_Install.zip
SET ARCHIVE_ZIP=%PROD%_01*_Install.zip


md %ARCHIVEFOLDER%\%prodver%
md %ARCHIVEFOLDER%\%prodver%\Archive
if "%COMPILE%" == "RELEASE" move %ARCHIVEFOLDER%\%prodver%\%ARCHIVE_ZIP% %ARCHIVEFOLDER%\%prod%\Archive

ECHO OFF
ECHO ================ Resources Files ============================
ECHO ON
CD install\resources
rem zip up all the resources into a single zip file
"C:\program files\pkware\pkzipc.exe" -add -dir=current %RESOURCES_ZIP% *.* -excl=*.zip
move %RESOURCES_ZIP% ..\
CD ..\..


rem zip up the install file
ECHO OFF
ECHO ================ Install Files ========================================================
ECHO ON
if "%COMPILE%" == "RELEASE" "C:\program files\pkware\pkzipc.exe" -add Install\%INSTALL_ZIP% install\*.* -excl=%INSTALL_ZIP%
if "%COMPILE%" == "DEBUG" "C:\program files\pkware\pkzipc.exe" -add Install\%DEBUG_INSTALL_ZIP% install\*.* -excl=%DEBUG_INSTALL_ZIP%
ECHO ON
if "%COMPILE%" == "RELEASE" copy install\%INSTALL_ZIP% \\echidna\ifinity\Installs\%prodver%\
if "%COMPILE%" == "DEBUG" copy install\%DEBUG_INSTALL_ZIP% \\echidna\ifinity\Installs\%prodver%\
ECHO OFF


if "%COMPILE%" == "RELEASE" (
ECHO CREATING SOURCE CODE ZIP FILE
rem zip up the source code
"C:\program files\pkware\pkzipc.exe" -add -dir=current %SRC_ZIP% *.* -excl=@SourceExclude.txt -excl
copy %SRC_ZIP% \\echidna\ifinity\Installs\%prodver%\ /Y
MOVE %SRC_ZIP% install\%SRC_ZIP% 

)

